<template>
	<view class="content">
		<view class="list" v-for="(item,index) in indexlist" :key="index" @click="informationdetails(item)">
			<view class="img">
				<image src="../../static/379.png" mode="" v-if="item.status == 1"></image>
				<image src="../../static/402.png" mode="" v-if="item.status == 2"></image>
			</view>
			<view class="information">
				<view class="title">
					{{item.title}}
				</view>
				<view class="name">
					<rich-text :nodes="item.content"></rich-text>
					<!-- {{}} -->
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {
		messagepage //消息列表
	} from "../../request/api.js"
	export default {
		data() {
			return {
				indexlist: [],
				type: '',
				pageNo: 1,
				ids: '',
				total: '',
			};
		},
		onReachBottom() {
			console.log(111);
			if (this.total <= this.indexlist.length) {
				uni.showToast({
					title: '已加载全部数据',
					icon: "none"
				});
			} else {
				this.pageNo++;
				this.messagepagea()
			}
		},
		onLoad(options) {

		},
		onShow() {
			this.indexlist = []
			this.messagepagea()
		},
		methods: {
			informationdetails(e) {
				getApp().globalData.informationdetails = e
				uni.navigateTo({
					url: '/pages/my/informationdetails'
				})
			},
			messagepagea() {
				uni.showLoading({
					title: '加载中...'
				})
				let that = this
				console.log(this.type);
				if (that.title) {
					that.indexlist = []
				}
				messagepage({
					memberId: uni.getStorageSync('userInfo').id,
					pageNo: that.pageNo,
				}).then(res => {
					console.log(res);
					that.indexlist = that.indexlist.concat(res.result.records)
					that.total = res.result.total; //数据总条数
					uni.hideLoading()
					if (that.indexlist.length == []) {
						uni.showToast({
							title: '信息为空',
							icon: 'none'
						})
					}
				})
			},
			selectItem(index) {
				this.selectedIdx = index;
			},
		},

	};
</script>

<style scoped lang="less">
	.content {
		width: 100%;
		min-height: 100vh;
		box-sizing: border-box;
		// padding: 16rpx;
		// padding-top: 0rpx;
		background: #f6f6f6;
		// padding-top: 20rpx;
		padding-bottom: 250rpx;
		padding: 28rpx 32rpx;
	}

	.list {
		padding: 28rpx 56rpx 14rpx 24rpx;
		border-radius: 24rpx;
		background: #ffffff;
		display: flex;
		margin-top: 20rpx;

		.img {
			width: 15%;

			image {
				width: 72rpx;
				height: 70rpx;
			}
		}

		.information {
			width: 84%;

			.title {
				color: #333333;
				font-size: 28rpx;
				font-weight: 500;
			}

			.name {
				margin-top: 20rpx;
				color: #9e9e9e;
				font-size: 28rpx;
				font-weight: 500;
				height: 112rpx;
				/* 假设每行高度为28px，共4行 */
				line-height: 28px;
				/* 假设每行高度为28px */
				overflow: hidden;
				text-overflow: ellipsis;
				// white-space: 4;
				/* 单行文本 */
			}
		}

	}
</style>